package com.uidt.project.ptsj.service.impl;

import java.util.List;
import com.uidt.common.utils.DateUtils;
import com.uidt.common.utils.SecurityUtils;
import com.uidt.common.utils.uuid.UUID;
import com.uidt.framework.security.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.uidt.project.ptsj.mapper.PtsjScreenPlaceRoomNumMapper;
import com.uidt.project.ptsj.domain.PtsjScreenPlaceRoomNum;
import com.uidt.project.ptsj.service.IPtsjScreenPlaceRoomNumService;

/**
 * 大屏场所和房源数Service业务层处理
 * 
 * @author uidt
 * @date 2024-10-23
 */
@Service
public class PtsjScreenPlaceRoomNumServiceImpl implements IPtsjScreenPlaceRoomNumService 
{
    @Autowired
    private PtsjScreenPlaceRoomNumMapper ptsjScreenPlaceRoomNumMapper;

    /**
     * 查询大屏场所和房源数
     * 
     * @param id 大屏场所和房源数主键
     * @return 大屏场所和房源数
     */
    @Override
    public PtsjScreenPlaceRoomNum selectPtsjScreenPlaceRoomNumById(String id)
    {
        return ptsjScreenPlaceRoomNumMapper.selectPtsjScreenPlaceRoomNumById(id);
    }

    /**
     * 查询大屏场所和房源数列表
     * 
     * @param ptsjScreenPlaceRoomNum 大屏场所和房源数
     * @return 大屏场所和房源数
     */
    @Override
    public List<PtsjScreenPlaceRoomNum> selectPtsjScreenPlaceRoomNumList(PtsjScreenPlaceRoomNum ptsjScreenPlaceRoomNum)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        ptsjScreenPlaceRoomNum.setGxdwdm(user.getUser().getDept().getDeptcode().split("-")[0]);
        return ptsjScreenPlaceRoomNumMapper.selectPtsjScreenPlaceRoomNumList(ptsjScreenPlaceRoomNum);
    }

    /**
     * 新增大屏场所和房源数
     * 
     * @param ptsjScreenPlaceRoomNum 大屏场所和房源数
     * @return 结果
     */
    @Override
    public int insertPtsjScreenPlaceRoomNum(PtsjScreenPlaceRoomNum ptsjScreenPlaceRoomNum)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        ptsjScreenPlaceRoomNum.setId(UUID.randomUUID().toString());
        ptsjScreenPlaceRoomNum.setGxdwdm(user.getUser().getDept().getDeptcode().split("-")[0]);
        ptsjScreenPlaceRoomNum.setCreateTime(DateUtils.getNowDate());
        return ptsjScreenPlaceRoomNumMapper.insertPtsjScreenPlaceRoomNum(ptsjScreenPlaceRoomNum);
    }

    /**
     * 修改大屏场所和房源数
     * 
     * @param ptsjScreenPlaceRoomNum 大屏场所和房源数
     * @return 结果
     */
    @Override
    public int updatePtsjScreenPlaceRoomNum(PtsjScreenPlaceRoomNum ptsjScreenPlaceRoomNum)
    {
        return ptsjScreenPlaceRoomNumMapper.updatePtsjScreenPlaceRoomNum(ptsjScreenPlaceRoomNum);
    }

    /**
     * 批量删除大屏场所和房源数
     * 
     * @param ids 需要删除的大屏场所和房源数主键
     * @return 结果
     */
    @Override
    public int deletePtsjScreenPlaceRoomNumByIds(String[] ids)
    {
        return ptsjScreenPlaceRoomNumMapper.deletePtsjScreenPlaceRoomNumByIds(ids);
    }

    /**
     * 删除大屏场所和房源数信息
     * 
     * @param id 大屏场所和房源数主键
     * @return 结果
     */
    @Override
    public int deletePtsjScreenPlaceRoomNumById(String id)
    {
        return ptsjScreenPlaceRoomNumMapper.deletePtsjScreenPlaceRoomNumById(id);
    }
}
